<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>{$main_title}</h2>
	</div>
	<div class="tab-wrap">
		<ul class="tab-nav nav">
			<li data-tab="tab1" class="{$tabNav.tab1|default='current'}"><a href="javascript:void(0);">基 础</a></li>
			<!--<li data-tab="tab2" class="{$tabNav.tab2|default='current'}"><a href="javascript:void(0);">高 级</a></li>-->
			<li data-tab="tab3" class="{$tabNav.tab3|default='current'}"><a href="javascript:void(0);">跟 踪</a></li>
		</ul>
		<div class="tab-content">
			<form action="__SELF__" method="post" class="form-horizontal">
				<!-- 基础 -->
				<div id="tab1" class="tab-pane {$tabNav.tab1|default='in'}  tab1">
					<div class="form-item">
						<label class="item-label">
						<em class="must">*</em>客户名称<span class="check-tips">（名称不能为空）</span></label>
						<div class="controls">
							<input type="text" class="text input-large" name="name"  value="{$info.name|default=''}"/>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">公司名称<span class="check-tips"></span>
						</label>
						<div class="controls">
							<input type="text" name="company" class="text input-large" value="{$info.company|default=''}">
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">
							联系方式
						</label>
						<div class="controls">
							<input type="text" name="contact_type" class="text input-large" value="{$info.contact_type|default=''}">
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">
							客户分类
						</label>
						<div class="controls">
							<label class="inline radio"><input type="radio" name="customer_type" data-value="{$info.customer_type}" value="fresh" checked>新鲜客户</label>
							<label class="inline radio"><input type="radio" name="customer_type" data-value="{$info.customer_type}" value="intention">意向客户</label>
							<label class="inline radio"><input type="radio" name="customer_type" data-value="{$info.customer_type}" value="vip">VIP</label>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">可见性<span class="check-tips">（其他人是否对该客户可见）</span></label>
						<div class="controls">
							<select name="visible" data-value="{$info.visible}">
								<option value="2">所有人可见</option>
								<option value="1">领导及自己可见</option>
								<option value="0">仅自己可见</option>
							</select>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">备注</label>
						<div class="controls">
							<input type="text" name="remark" class="text input-large" value="{$info.remark|default=''}">
						</div>
					</div>
					<!----
					<div class="form-item">
						<label class="item-label">
							<em class="must">*</em>是否审核<span class="check-tips">（在该分类下发布的内容是否需要审核）</span>
						</label>
						<div class="controls">
							<label class="inline radio"><input type="radio" name="check" value="0" checked>不需要</label>
							<label class="inline radio"><input type="radio" name="check" value="1">需要</label>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label"><em class="must">*</em>绑定文档模型</label>
						<div class="controls">
							<volist name=":get_document_model()" id="list">
								<label class="checkbox">
									<input type="checkbox" name="model[]" value="{$list.id}">{$list.title}
								</label>
							</volist>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label"><em class="must">*</em>允许文档类型</label>
						<div class="controls">
							<volist name=":C('DOCUMENT_MODEL_TYPE')" id="type">
								<label class="checkbox">
									<input type="checkbox" name="type[]" value="{$key}">{$type}
								</label>
							</volist>
						</div>
					</div>
					-------->
				</div>
				
				<!-- 高级 -->
				<div id="tab2" class="tab-pane {$tabNav.tab2|default='in'}  tab2">
					
					
					<div class="form-item">
						<label class="item-label">
							跟踪<span class="check-tips">（是否允许可见对该客户进行跟踪）</span>
						</label>
						<div class="controls">
							<label class="inline radio"><input type="radio" name="reply" value="1" checked>允许</label>
							<label class="inline radio"><input type="radio" name="reply" value="0">不允许</label>
						</div>
					</div>
					<div class="form-item reply hidden">
						<label class="item-label">回复绑定的文档模型</label>
						<div class="controls">
							<volist name=":get_document_model()" id="list">
								<label class="checkbox">
									<input type="checkbox" name="reply_model[]" value="{$list.id}">{$list.title}
								</label>
							</volist>
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">
							排序<span class="check-tips">（仅对当前层级分类有效）</span>
						</label>
						<div class="controls">
							<input type="text" name="sort" class="text input-small" value="{$info.sort|default=0}">
						</div>
					</div>
					<div class="form-item">
						<label class="item-label">
							列表行数
						</label>
						<div class="controls">
							<input type="text" name="list_row" class="text input-small" value="{$info.list_row|default=10}">
						</div>
					</div>

				</div>
				
				<!-- 高级 -->
				<div id="tab3" class="tab-pane {$tabNav.tab3|default='in'}  tab3">
					<div class="form-item">
						<label class="item-label">客户跟踪记录</label>
						<div class="controls">
							<textarea type="text" name="track_content" class="textarea"  rows="5">
							</textarea>
						</div>
					</div>
					<label class="item-label">历史跟踪记录</label>
					<volist name="track" id="vo">
						<div class="form-item">
							<label>跟踪时间:   {$vo.create_time}</label>
							<div class="controls">
								<textarea type="text" class="textarea" disabled>{$vo.track_content|default=''}</textarea>
							</div>
						</div>
					</volist>
				</div>

				<div class="form-item">
					<input type="hidden" name="id" value="{$info.id|default=''}">
					<input type="hidden" name="pid" value="{$category['id']?$category['id']:$info['pid']}">
					<button type="submit" id="submit" class="btn submit-btn ajax-post" target-form="form-horizontal">确 定</button>
					<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
				</div>
			</form>
		</div>
	</div>
</block>

<block name="script">
	<script type="text/javascript">
		Think.setValue("allow_publish", {$info.allow_publish|default=1});
		Think.setValue("check", {$info.check|default=0});
		Think.setValue("model[]", {$info.model|json_encode} || [1]);
		Think.setValue("type[]", {$info.type|json_encode} || [2]);
		Think.setValue("display", {$info.display|default=1});
		Think.setValue("reply", {$info.reply|default=0});
		Think.setValue("reply_model[]", {$info.reply_model|json_encode} || [1]);
		Think.setValue("reply_type[]", {$info.reply_type|json_encode} || [2]);
		$(function(){
			showTab();
			showSelect();
			showRadio();
			$("input[name=reply]").change(function(){
				var $reply = $(".form-item.reply");
				parseInt(this.value) ? $reply.show() : $reply.hide();
			}).filter(":checked").change();
		});
		//导航高亮
		$('.side-sub-menu').find('a[href="{:U('Category/index')}"]').closest('li').addClass('current');
	</script>
</block>
